package com.example.Goods.service.impl;


import com.example.Goods.domain.Goods;
import com.example.Goods.domain.Vo.goodsListVo;
import com.example.Goods.mapper.GoodsMapper;
import com.example.Goods.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 服务层
 */
@Service
public class GoodsImpl implements IGoodsService {
    @Autowired
    private GoodsMapper goodsMapper;


    /**
     * 查询商品
     * @param goods
     * @return
     */
    @Override
    public List<goodsListVo> selectGoods(Goods goods) {
        return goodsMapper.selectGoods(goods);
    }


    /**
     * 新增商品
     * @param goods
     */
    @Override
    public void insertGoods(Goods goods) {
        goodsMapper.insertGoods(goods);
    }


    /**
     * 修改商品
     * @param goods
     */
    @Override
    public void updateGoodsById(Goods goods) {
        goodsMapper.updateGoodsById(goods);
    }


    /**
     * 删除商品
     * @param goodsId
     */
    @Override
    public void delGoodsById(String goodsId) {
        goodsMapper.delGoodsById(goodsId);
    }


    @Override
    public List<Goods> getOtherGoodsList(Integer userId) { return goodsMapper.getOtherGoodsList(userId); }

    @Override
    public List<Goods> getGoodsByUserId(Integer userId) {
        return goodsMapper.getGoodsByUserId(userId);
    }
}
